package com.sgb.kjwl.view.ui.activity.self.packers;

import android.annotation.SuppressLint;
import android.content.Intent;
import android.graphics.Color;
import android.os.Bundle;
import android.text.InputType;
import android.text.TextUtils;
import android.view.View;
import android.widget.Toast;

import androidx.annotation.Nullable;
import androidx.core.content.ContextCompat;
import androidx.databinding.DataBindingUtil;
import androidx.recyclerview.widget.GridLayoutManager;
import androidx.recyclerview.widget.LinearLayoutManager;

import com.bigkoo.pickerview.builder.OptionsPickerBuilder;
import com.bigkoo.pickerview.builder.TimePickerBuilder;
import com.bigkoo.pickerview.view.OptionsPickerView;
import com.bigkoo.pickerview.view.TimePickerView;
import com.bumptech.glide.Glide;
import com.bumptech.glide.load.resource.bitmap.CenterCrop;
import com.bumptech.glide.load.resource.bitmap.RoundedCorners;
import com.bumptech.glide.request.RequestOptions;
import com.luck.picture.lib.PictureSelector;
import com.luck.picture.lib.config.PictureConfig;
import com.luck.picture.lib.decoration.GridSpacingItemDecoration;
import com.luck.picture.lib.entity.LocalMedia;
import com.luck.picture.lib.tools.ScreenUtils;
import com.sgb.kjwl.AppActivity;
import com.sgb.kjwl.AppConstant;
import com.sgb.kjwl.R;
import com.sgb.kjwl.databinding.ActivitySelfTeamMemberEditBinding;
import com.sgb.kjwl.di.self.DaggerSelfComponent;
import com.sgb.kjwl.di.self.SelfModule;
import com.swgk.core.util.PickSelectEntity;
import com.sgb.kjwl.model.entity.self.SelfEmploymentEditEntity;
import com.sgb.kjwl.model.entity.self.SelfTeamMemberEntity;
import com.sgb.kjwl.view.ui.activity.PhotoViewActivity;
import com.sgb.kjwl.view.ui.adapter.packers.AddCertificateAdapter;
import com.sgb.link.view.adapter.SelfTeamPicAdapter;
import com.sgb.kjwl.viewmodel.self.packers.SelfTeamMemberEditModel;
import com.swgk.core.base.di.AppComponent;
import com.swgk.core.customview.ItemInputTextView;
import com.swgk.core.dialog.DialogHelper;
import com.swgk.core.recyclerview.adapter.AdapterOnItemClick;
import com.swgk.core.util.CheckUtils;
import com.swgk.core.util.MToast;

import java.io.File;
import java.io.Serializable;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Calendar;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

import javax.inject.Inject;

/**
 *
 * @author WYJ
 * @date 2020/8/28
 * description: 新增或修改团队人员
 */
public class SelfTeamMemberEditActivity extends AppActivity implements ItemInputTextView.OnWholeItemClickListener {

    @Inject
    public SelfTeamMemberEditModel mModel;
    private ActivitySelfTeamMemberEditBinding mBind;

    private SelfTeamMemberEntity mEntity;
    private SelfTeamPicAdapter mAdapter;
    /**
     * 业绩证明图片
     */
    private SelfTeamPicAdapter mPerformanceAdapter;
    /**
     * 新增证书
     */
    private AddCertificateAdapter addCertificateAdapter;
    /**
     * 是否是业绩证明
     */
    private boolean isPerformance;
    private List<String> mUploadImgList;
    private List<String> mUploadImgList2;
    /**
     * 防止重复上传
     */
    private Map<String, String> mCacheMap;
    /**
     * 防止重复上传
     */
    private Map<String, String> mCacheMap2;
    private int mCurNum;
    private int mCurNum2;
    private List<PickSelectEntity> nationRecordList;
    private List<PickSelectEntity> sexList;
    private List<PickSelectEntity> marriageList;
    public static final int REQUEST_AVATAR_CODE = 10104;
    private String avatar = "";

    public static void start(AppActivity context, SelfTeamMemberEntity entity, int code) {
        Intent intent = new Intent(context, SelfTeamMemberEditActivity.class);
        intent.putExtra(AppConstant.EXTRA_ENTITY, entity);
        context.startActivityForResult(intent, code);
    }

    @Override
    protected void setupActivityComponent(AppComponent appComponent) {
        DaggerSelfComponent.builder()
                .appComponent(appComponent)
                .selfModule(new SelfModule(this))
                .build()
                .inject(this);
    }

    @Override
    protected void onCreate(@Nullable @org.jetbrains.annotations.Nullable Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        if (mEntity == null) {
            mEntity = new SelfTeamMemberEntity();
            mEntity.setId(0L);
            mActionBar.setTitle(String.format("添加%s", getResources().getString(R.string.self_team8)));
        } else {
            mActionBar.setTitle(String.format("编辑%s", getResources().getString(R.string.self_team8)));
            mModel.detailTeamMember(mEntity);
        }
    }

    @Override
    protected void initView() {
        mUploadImgList = new ArrayList<>();
        mUploadImgList2 = new ArrayList<>();
        mCacheMap = new HashMap<>();
        mCacheMap2 = new HashMap<>();
        mEntity = (SelfTeamMemberEntity) getIntent().getSerializableExtra(AppConstant.EXTRA_ENTITY);
        mBind = DataBindingUtil.setContentView(this, R.layout.activity_self_team_member_edit);
        mBind.setViewModel(mEntity);
        mBind.ivMemberAvatar.setOnClickListener(this);
        mBind.btnRelease.setOnClickListener(this);
        mBind.addBtn.setOnClickListener(this);
        mBind.etWorkType.setOnWholeItemClickListener(this);
        mBind.etHometown.setOnWholeItemClickListener(this);
        mBind.etNation.setOnWholeItemClickListener(this);
        mBind.etSex.setOnWholeItemClickListener(this);
        mBind.etBirth.setOnWholeItemClickListener(this);
        mBind.etMarriage.setOnWholeItemClickListener(this);
        mBind.etName.setInfilterType(ItemInputTextView.TYPE_NAME);
        mBind.etAge.getContent_edt().setInputType(InputType.TYPE_CLASS_NUMBER);
        mBind.etWorkAge.getContent_edt().setInputType(InputType.TYPE_CLASS_NUMBER);
        mBind.etPhone.getContent_edt().setInputType(InputType.TYPE_CLASS_PHONE);
        mBind.etPhone.setInfilterType(ItemInputTextView.TYPE_PHONE);
        mBind.etIdCard.setInfilterType(ItemInputTextView.TYPE_INDO);

        List<String> tempData = new ArrayList<>();
        if (mEntity != null && mEntity.getCertificatePath() != null && mEntity.getCertificatePath().size() > 0) {
            tempData.addAll(mEntity.getCertificatePath());
        }
        GridLayoutManager manager = new GridLayoutManager(this, 4);
        mBind.rvPic.setLayoutManager(manager);
        mAdapter = new SelfTeamPicAdapter(this, tempData, AppConstant.UPLOAD_MAX_SIZE, manager);
        mBind.rvPic.setHasFixedSize(false);
        mBind.rvPic.addItemDecoration(new GridSpacingItemDecoration(5, ScreenUtils.dip2px(this, 2), false));
        mBind.rvPic.setAdapter(mAdapter);
        mAdapter.setOnItemClick(new AdapterOnItemClick<String>() {
            @Override
            public void onItemClick(String s, int position) {
                isPerformance = false;
                if (TextUtils.isEmpty(s)) {
                    mModel.pictureSelector(mAdapter.hasCount(), PictureConfig.CHOOSE_REQUEST);
                } else {
                    Intent intent = new Intent(getActivity(), PhotoViewActivity.class);
                    intent.putExtra(PhotoViewActivity.KEY_PHOTO_URLS, (Serializable) mAdapter.getDatas());
                    intent.putExtra(PhotoViewActivity.KEY_PHOTO_POSITION, position);
                    startActivity(intent);
                }
            }
        });
        GridLayoutManager manager2 = new GridLayoutManager(this, 4);
        mBind.rvPerformancePic.setLayoutManager(manager2);
        mPerformanceAdapter = new SelfTeamPicAdapter(this, null, AppConstant.UPLOAD_MAX_SIZE, manager2);
        mBind.rvPerformancePic.setHasFixedSize(false);
        mBind.rvPerformancePic.addItemDecoration(new GridSpacingItemDecoration(5, ScreenUtils.dip2px(this, 2), false));
        mBind.rvPerformancePic.setAdapter(mPerformanceAdapter);
        mPerformanceAdapter.setOnItemClick(new AdapterOnItemClick<String>() {
            @Override
            public void onItemClick(String s, int position) {
                isPerformance = true;
                if (TextUtils.isEmpty(s)) {
                    mModel.pictureSelector(mPerformanceAdapter.hasCount(), PictureConfig.CHOOSE_REQUEST);
                } else {
                    Intent intent = new Intent(getActivity(), PhotoViewActivity.class);
                    intent.putExtra(PhotoViewActivity.KEY_PHOTO_URLS, (Serializable) mPerformanceAdapter.getDatas());
                    intent.putExtra(PhotoViewActivity.KEY_PHOTO_POSITION, position);
                    startActivity(intent);
                }
            }
        });

        if (addCertificateAdapter == null) {
            addCertificateAdapter = new AddCertificateAdapter(getActivity(), null);
        }
        mBind.certificateList.setAdapter(addCertificateAdapter);
        mBind.certificateList.setLayoutManager(new LinearLayoutManager(this));
        addCertificateAdapter.setOnClose(position -> {
            addCertificateAdapter.removeItem(position);
            if (addCertificateAdapter.getDatas().size() == 0) {
                mBind.certificateList.setVisibility(View.GONE);
            }
        });

        mModel.getWorkType();
    }

    @Override
    public void onMultiClick(View v) {
        int id = v.getId();
        if (id == R.id.btn_release) {
            if (TextUtils.isEmpty(mBind.etName.getContent())) {
                MToast.showToast(this, mBind.etName.getContent_edt().getHint().toString());
                return;
            }
            if (TextUtils.isEmpty(mBind.etWorkAge.getContent())) {
                MToast.showToast(this, mBind.etWorkAge.getContent_edt().getHint().toString());
                return;
            }
            if (TextUtils.isEmpty(mBind.etWorkType.getContent())) {
                MToast.showToast(this, mBind.etWorkType.getContent_edt().getHint().toString());
                return;
            }
            if (TextUtils.isEmpty(mBind.etPhone.getContent())) {
                MToast.showToast(this, mBind.etPhone.getContent_edt().getHint().toString());
                return;
            }
            if (!CheckUtils.isMobile(mBind.etPhone.getContent().trim())) {
                Toast.makeText(this, "请填写正确的联系电话", Toast.LENGTH_SHORT).show();
                return;
            }
            if (!TextUtils.isEmpty(mBind.etIdCard.getContent())) {
                if (!CheckUtils.isIDNumber(mBind.etIdCard.getContent())) {
                    MToast.showToast(SelfTeamMemberEditActivity.this, "身份认证失败，请检查姓名和身份证号是否正确");
                    return;
                }
            }

            mEntity.setName(mBind.etName.getContent());
            mEntity.setIdentity(mBind.etIdCard.getContent());
            mEntity.setContactPhone(mBind.etPhone.getContent());
            mEntity.setPosition(mBind.etPost.getContent());
            mEntity.setWorkingYear(!TextUtils.isEmpty(mBind.etWorkAge.getContent()) ? Integer.parseInt(mBind.etWorkAge.getContent()) : 0);
            mEntity.setWorkType(mBind.etWorkType.getContent());
            mEntity.setIntroduction(mBind.etIntroduction.getEditContent());
            mEntity.setPerformanceContent(mBind.etPerformance.getEditContent());
            mUploadImgList.clear();
            mUploadImgList2.clear();

            mCurNum = -1;
            mCurNum2 = -1;
            uploadAvatar();
        } else if (id == R.id.iv_member_avatar) {
            mModel.pictureSelector(1, REQUEST_AVATAR_CODE);
        } else if (id == R.id.add_btn) {
            if (addCertificateAdapter.getDatas().size() < 5) {
                addNewText();
            } else {
                MToast.showToast(this, "最多只能新增5个证书");
            }
        }
    }

    private void addNewText() {
        if (mBind.certificateList.getVisibility() == View.GONE) {
            mBind.certificateList.setVisibility(View.VISIBLE);
        }
        SelfEmploymentEditEntity.NewText emtData;
        List<SelfEmploymentEditEntity.NewText> emtList;
        emtData = new SelfEmploymentEditEntity.NewText();
        emtData.setName("");
        emtList = new ArrayList<>();
        emtList.add(emtData);
        addCertificateAdapter.addDatas(emtList);
        addCertificateAdapter.upDate();
    }

    /**
     * 上传头像
     */
    private void uploadAvatar() {
        //过滤已上传头像且上传新头像
        if (TextUtils.isEmpty(mEntity.getAvatarAddress()) || !TextUtils.isEmpty(avatar)) {
            if (null != avatar && !TextUtils.isEmpty(avatar)) {
                File file = new File(avatar);
                mModel.uploadAvatarFileModel(file, 1);
            } else {
                setCertificatePicList();
            }
        } else {
            setCertificatePicList();
        }
    }

    private void setCertificatePicList() {
        mCurNum++;
        int size = mAdapter.getRealCount();
        if (size > 0 && mCurNum < size) {
            String path = mAdapter.getDatas().get(mCurNum);
            if (path.startsWith("http")) {
                // 保存已上传图片
                mUploadImgList.add(path);
                setCertificatePicList();
            } else {
                // 过滤已上传的
                if (!TextUtils.isEmpty(mCacheMap.get(path))) {
                    mUploadImgList.add(mCacheMap.get(path));
                    setCertificatePicList();
                } else {
                    File file = new File(mAdapter.getDatas().get(mCurNum));
                    mModel.uploadMultiFileModel(file, mCurNum + 1, size, false);
                }
            }
        } else {
            setPerformanceList();
        }
    }

    private void setPerformanceList() {
        mCurNum2++;
        int size = mPerformanceAdapter.getRealCount();
        if (size > 0 && mCurNum2 < size) {
            String path = mPerformanceAdapter.getDatas().get(mCurNum2);
            if (path.startsWith("http")) {
                mUploadImgList2.add(path); // 保存已上传图片
                setPerformanceList();
            } else {
                // 过滤已上传的
                if (!TextUtils.isEmpty(mCacheMap2.get(path))) {
                    mUploadImgList2.add(mCacheMap2.get(path));
                    setPerformanceList();
                } else {
                    File file = new File(mPerformanceAdapter.getDatas().get(mCurNum2));
                    mModel.uploadMultiFileModel(file, mCurNum2 + 1, size, true);
                }
            }
        } else {
            release();
        }
    }

    /**
     * 发布
     */
    private void release() {
        List<SelfTeamMemberEntity.CertificatesBean> certificatesBeans = new ArrayList<>();
        if (mUploadImgList.size() > 0) {
            for (String s : mUploadImgList) {
                SelfTeamMemberEntity.CertificatesBean bean = new SelfTeamMemberEntity.CertificatesBean();
                bean.setName("");
                bean.setPicture(s);
                certificatesBeans.add(bean);
            }
        }
        mEntity.setCertificates(certificatesBeans);
        List<SelfTeamMemberEntity.CertificatesBean> performances = new ArrayList<>();
        if (mUploadImgList2.size() > 0) {
            for (String s : mUploadImgList2) {
                SelfTeamMemberEntity.CertificatesBean bean = new SelfTeamMemberEntity.CertificatesBean();
                bean.setName("");
                bean.setPicture(s);
                performances.add(bean);
            }
        }
        mEntity.setPerformances(performances);
        if (addCertificateAdapter.getDatas().size() > 0) {
            List<String> stringList = new ArrayList<>();
            for (int i = 0; i < addCertificateAdapter.getDatas().size(); i++) {
                if (!TextUtils.isEmpty(addCertificateAdapter.getDatas().get(i).getName())) {
                    stringList.add(addCertificateAdapter.getDatas().get(i).getName());
                }
            }
            mEntity.setCertificateName(stringList);
        }
        mModel.addTeamMember(mEntity);
    }

    /**
     * 上传头像回调
     * @param toString
     */
    public void uploadAvatarResult(String toString) {
        mEntity.setAvatarAddress(toString);
        avatar = null;
        setCertificatePicList();
    }

    /**上传图片回调
     *
     * @param fromString
     * @param toString
     * @param isPerformance
     */
    public void uploadRefresh(String fromString, String toString, boolean isPerformance) {
        if (isPerformance) {
            mUploadImgList2.add(toString);
            mCacheMap2.put(fromString, toString);
            setPerformanceList();
        } else {
            mUploadImgList.add(toString);
            mCacheMap.put(fromString, toString);
            setCertificatePicList();
        }
    }

    @Override
    public void OnWholeItemClick(View view) {
        int id = view.getId();
        if (id == R.id.et_work_type) {
            mModel.showPop(mBind.grayLayout);
        } else if (id == R.id.et_hometown) {
            mModel.showAddressPop();
        } else if (id == R.id.et_nation) {
            if (nationRecordList == null) {
                mModel.getNationRecord();
            } else {
                showNationRecordPop(nationRecordList);
            }
        } else if (id == R.id.et_marriage) {
            if (null == marriageList) {
                marriageList = new ArrayList<>();
                marriageList.add(new PickSelectEntity("0", "未婚"));
                marriageList.add(new PickSelectEntity("1", "已婚"));
            }
            marriageStatusPop(marriageList);
        } else if (id == R.id.et_sex) {
            if (null == sexList) {
                sexList = new ArrayList<>();
                sexList.add(new PickSelectEntity("0", "男"));
                sexList.add(new PickSelectEntity("1", "女"));
            }
            sexStatusPop(sexList);
        } else if (id == R.id.et_birth) {
            showCourseTimePop();
        }

    }

    public void setWorkTypeFilter(PickSelectEntity data) {
        mBind.etWorkType.setContent(data.getProjectscale());
        mEntity.setWorkType(data.getProjectscale());
    }

    public void showNationRecordPop(List<PickSelectEntity> list) {
        if (null == nationRecordList) {
            nationRecordList = new ArrayList<>();
            nationRecordList.addAll(list);
        }
        if (nationRecordList.size() > 0) {
            OptionsPickerView projectCategoryOption = new OptionsPickerBuilder(SelfTeamMemberEditActivity.this, (options1, options2, options3, v) -> {
                mBind.etNation.setContent(nationRecordList.get(options1).getProjectscale());
                mEntity.setNation(nationRecordList.get(options1).getNo());
            }).setCancelColor(ContextCompat.getColor(this, R.color.color_666666)).setTitleColor(ContextCompat.getColor(this, R.color.color_969696)).build();
            projectCategoryOption.setPicker(nationRecordList);
            projectCategoryOption.setTitleText("请选择民族");
            projectCategoryOption.setSelectOptions(0);
            projectCategoryOption.show();
        }
    }

    public void sexStatusPop(List<PickSelectEntity> list) {
        if (list.size() > 0) {
            OptionsPickerView projectCategoryOption = new OptionsPickerBuilder(SelfTeamMemberEditActivity.this, (options1, options2, options3, v) -> {
                mBind.etSex.setContent(list.get(options1).getProjectscale());
                mEntity.setSex(list.get(options1).getNo());
            }).setCancelColor(ContextCompat.getColor(this, R.color.color_666666)).setTitleColor(ContextCompat.getColor(this, R.color.color_969696)).build();
            projectCategoryOption.setPicker(list);
            projectCategoryOption.setTitleText("请选择性别");
            projectCategoryOption.setSelectOptions(0);
            projectCategoryOption.show();
        }
    }

    public void marriageStatusPop(List<PickSelectEntity> list) {
        if (list.size() > 0) {
            OptionsPickerView projectCategoryOption = new OptionsPickerBuilder(SelfTeamMemberEditActivity.this, (options1, options2, options3, v) -> {
                mBind.etMarriage.setContent(list.get(options1).getProjectscale());
                mEntity.setMarriage(list.get(options1).getNo());
            }).setCancelColor(ContextCompat.getColor(this, R.color.color_666666)).setTitleColor(ContextCompat.getColor(this, R.color.color_969696)).build();
            projectCategoryOption.setPicker(list);
            projectCategoryOption.setTitleText("请选择婚姻");
            projectCategoryOption.setSelectOptions(0);
            projectCategoryOption.show();
        }
    }

    private void showCourseTimePop() {
        Calendar dayCalendar = Calendar.getInstance();
        dayCalendar.setTime(new Date());
        TimePickerView timePicker = new TimePickerBuilder(this, (date, v) -> {
            @SuppressLint("SimpleDateFormat") SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
            String format = sdf.format(date);
            try {
                mBind.etBirth.setContent(format);
                mEntity.setBirthDay(format);
            } catch (Exception e) {
                e.printStackTrace();
            }
        }).setType(new boolean[]{true, true, true, false, false, false})
                .setCancelText("取消").setSubCalSize(15)
                .setCancelColor(Color.parseColor("#666666"))
                .setTitleText("请选择出生日")
                .setTitleColor(Color.parseColor("#969696")).setTitleSize(15)
                .setSubmitText("确定")
                .setSubmitColor(Color.parseColor("#5792FD"))
                .setRangDate(null, Calendar.getInstance())
                .build();
        timePicker.show();
    }

    @Override
    protected void onActivityResult(int requestCode, int resultCode, Intent data) {
        super.onActivityResult(requestCode, resultCode, data);
        if (resultCode == RESULT_OK) {
            if (requestCode == PictureConfig.CHOOSE_REQUEST) {
                List<LocalMedia> selectList = PictureSelector.obtainMultipleResult(data);
                if (isPerformance) {
                    mPerformanceAdapter.setPicData(selectList);
                } else {
                    mAdapter.setPicData(selectList);
                }
            }
            if (requestCode == REQUEST_AVATAR_CODE) {
                List<LocalMedia> selectList = PictureSelector.obtainMultipleResult(data);
                RequestOptions options = new RequestOptions();
                options.transforms(new CenterCrop(), new RoundedCorners(8));
                Glide.with(this).load(selectList.get(0).getRealPath()).apply(options).into(mBind.ivMemberAvatar);
                avatar = selectList.get(0).getRealPath();
            }
        }
    }

    public void editEntitySuccess() {
        setResult(RESULT_OK, new Intent().putExtra(AppConstant.EXTRA_OBJ, mEntity));
        finish();
    }

    public void updateOfferEntity(SelfTeamMemberEntity data) {
        if (data != null) {
            mEntity = data;
            mBind.setViewModel(mEntity);
            RequestOptions options = new RequestOptions();
            options.placeholder(R.mipmap.worker_avatar);
            options.transforms(new CenterCrop(), new RoundedCorners(8));
            if (TextUtils.isEmpty(data.getAvatarAddress())) {
                Glide.with(this).load(R.mipmap.worker_avatar).into(mBind.ivMemberAvatar);
            } else {
                Glide.with(this).load(data.getAvatarAddress()).apply(options).into(mBind.ivMemberAvatar);
            }
            mBind.etWorkAge.setContent(data.getWorkingYear() + "");
            if (mEntity.getCertificates() != null && mEntity.getCertificates().size() > 0) {
                List<String> stringList = new ArrayList<>();
                for (SelfTeamMemberEntity.CertificatesBean bean : mEntity.getCertificates()) {
                    stringList.add(bean.getPicture());
                }
                mAdapter.setData(stringList);
            }
            if (mEntity.getPerformancePicDTOS() != null && mEntity.getPerformancePicDTOS().size() > 0) {
                mEntity.setPerformances(mEntity.getPerformancePicDTOS());
                List<String> stringList2 = new ArrayList<>();
                for (SelfTeamMemberEntity.CertificatesBean bean : mEntity.getPerformances()) {
                    stringList2.add(bean.getPicture());
                }
                mPerformanceAdapter.setData(stringList2);
            }
            if (mEntity.getCertificateName() != null && mEntity.getCertificateName().size() > 0) {
                mBind.certificateList.setVisibility(View.VISIBLE);
                List<SelfEmploymentEditEntity.NewText> newTexts = new ArrayList<>();
                for (int i = 0; i < mEntity.getCertificateName().size(); i++) {
                    SelfEmploymentEditEntity.NewText emtData = new SelfEmploymentEditEntity.NewText();
                    emtData.setName(mEntity.getCertificateName().get(i));
                    newTexts.add(emtData);
                }
                addCertificateAdapter.addDatas(newTexts);
            }
        }
    }

    /**
     * 区域回调
     * @param opt1
     * @param opt2
     */
    public void updateAddress(PickSelectEntity<List<PickSelectEntity>> opt1, PickSelectEntity opt2) {
        mEntity.setHomeProNo(opt1.getNo());
        mEntity.setHomeCityNo(opt2.getNo());
        mBind.etHometown.setContent(opt1.getProjectscale() + opt2.getProjectscale());
    }

    public void showEmpty() {
        mBind.emptyView.setVisibility(View.VISIBLE);
        DialogHelper.dismissProgressDialog();
    }

}
